import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import WindiCSS from 'vite-plugin-windicss';

// https://vite.dev/config/
export default defineConfig({
    plugins: [vue(), WindiCSS()],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src'), // 设置别名
            'components': path.resolve(__dirname, './src/components'),
        },
        extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'], // 扩展文件后缀解析
    },
    //设置默认打开浏览器和设置端口号
    server: {
        open: true,
        port: 3000,
        proxy: {
            '/api': {
                target: 'http://ceshi13.dishait.cn',
                changeOrigin: true,
                rewrite: (path)=> path.replace(/^\/api/, '')
            }
        }
    }
})
